// user.js作用是存放 和用户相关的请求
// 登录 注册 更换头像 重置密码.....................

import request from '@/utils/request'

// 注册的请求
export const regAPI = obj => {
  // obj = { username: '', password: '', repassword: '' }
  return request.post('/api/reg', obj)
}
export const loginAPI = data => {
  // obj = { username: '', password: '', repassword: '' }
  return request.post('/api/login ', data)
}

export const getUserAPI = () => {
  // request.post('接口地址'{ 配置项 })
  return request.get('/my/userinfo')
}
export const updateAPI = data => {
  return request.put('/my/userinfo', data)
}
export const updatePwdAPI = data => {
  // return request.put('/my/userinfo', 请求体)
  return request.patch('/my/updatepwd', data)
}
export const updateAvatarAPI = str => {
  return request.patch('/my/update/avatar', { avatar: str })
}
